#define _CRT_SECURE_NO_WARNINGS 1

class Solution {
public:
    int minimumOperations(vector<int>& nums) {
        unordered_set<int> hash;
        int n = nums.size();
        int i = n - 1;
        for (i = n - 1; i >= 0; --i)
        {
            if (hash.find(nums[i]) == hash.end())
                hash.insert(nums[i]);
            else
                break;
        }
        return (i + 3) / 3;
    }
};